package day9;


import java.util.Arrays;
import java.util.Scanner;

public class Jdk {
    public static void main(String[] args) {
        String s="jdk";
        String s1=s.toUpperCase();
        String s2=s1.substring(1);
        System.out.println("变换的结果为："+s1);
        System.out.println("截取的结果为："+s2);

    }
}


class Jiequ{
    public static void main(String[] args) {
        String s="name=zhangsan age=18 classNo=090728";
        String strs[]=s.split(" ");
        System.out.println(Arrays.toString(strs));
        for (String str:strs){
            if (str.contains("=")){
                int i=str.indexOf("=");
                String str1=str.substring(i+1);
                System.out.print(str1+" ");
            }
        }
    }
}

class Duichen{
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.print("请输入一个字符串：");
        String str=sc.next();
        char strs[]=str.toCharArray();
        int j=0;
        for (int i=0;i<strs.length/2;i++){
            if (strs[i]==strs[strs.length-i-1]){
                j++;
            }
        }
        if (j==strs.length/2){
            System.out.println("这是一个对称的字符串！");
        }else {
            System.out.println("这不是一个对称的字符串！");
        }
    }
    //递归方法
public static String reverse(String str){
    return reverse(str.substring(1)) + str.charAt(0);
}

}

class Random{
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.print("请输入想要的字符串的长度：");
        int str=sc.nextInt();
        char ch[]=new char[str];
        for (int i=0;i<str;i++){
            int n=(int)(Math.random()*62);
            if (n>=48&&n<=57 || n>=65&&n<=90 ||n>=97&&n<=122){
                ch[i]= (char) n;
            }else {
                i--;
            }
        }
        String str1=new String(ch);
        System.out.println("随机生成的字符串为："+str1);
    }
}

class Change {
    public static void main(String[] args) {
        String str = "AkleBiCeilD";
        System.out.println("排序前："+str);
        String result = move(str);
        System.out.println("排序后："+result);
    }
    public static String move(String str) {
        char[] chars = str.toCharArray();
        int a = 0;
        for (char c : chars) {
            if (c >= 'A' && c <= 'Z') {
                a++;
            }
        }
        char[] ch = new char[chars.length];
        int n = 0;
        int m = chars.length - a;
        for (char c : chars) {
            if (c < 'A' || c > 'Z') {
                ch[n++] = c;
            }else {
                ch[m++] = c;
            }
        }
        return new String(ch);
    }
}
